<!DOCTYPE html>
<html>
<body>
    <input type="number" id="n1" placeholder="数字">
    <input type="number" id="n2" placeholder="数字">
    <input type="number" id="n3" placeholder="数字">
    <button onclick="sort()">排序</button>
    <p id="result"></p>

    <script>
        function sort() {
            const getNum = id => {
                const val = document.getElementById(id).value;
                return val.trim() === "" ? NaN : Number(val);
            };

            const a = getNum('n1');
            const b = getNum('n2');
            const c = getNum('n3');

            if ([a, b, c].some(isNaN)) {
                alert("请输入三个有效数字！");
                return;
            }

            document.getElementById('result').innerHTML = 
                [a, b, c].sort((x, y) => y - x).join(" > ");
        }
    </script>
</body>
</html>